package routers

import (
	"server/controller"

	"github.com/gin-gonic/gin"
)

func SetupRouter() *gin.Engine {
	// 创建服务器
	r := gin.Default()
	{
		apiGroup := r.Group("pan-api")
		apiGroup.GET("/auth", controller.AuthenticationPage)
		apiGroup.GET("/auth/code", controller.AuthenticationCode)
		apiGroup.GET("/auth/access_token", controller.Authentication)
		apiGroup.GET("/auth/refresh_token", controller.RefreshAuthentication)
		apiGroup.GET("/user/info", controller.GetUserInfo)
		apiGroup.GET("/openFile/list", controller.GetOpenFileList)
		apiGroup.GET("/oauth/users/scopes", controller.GetUserInfoScopes)
		apiGroup.POST("/oauth/authorize/qrcode", controller.GetAuthQrcode)
		apiGroup.GET("/oauth/authorize/qrcode/status", controller.GetAuthQrcodeStatus)
		apiGroup.POST("/auth/file/detail", controller.GetFileDetailById)
		apiGroup.POST("/auth/file/download", controller.GetFileDownload)

		duApiGroup := r.Group("pan-api/du")
		duApiGroup.GET("/oauth", controller.DuAuthenticationPage)
		duApiGroup.GET("/token", controller.DuAuthenticationToken)
		duApiGroup.GET("/user_info", controller.DuGetUserInfo)
		duApiGroup.GET("/doc/list", controller.DuGetDocList)                // 获取文档列表
		duApiGroup.GET("/file/list", controller.DuGetFileListRecursion)     // 递归获取文件列表
		duApiGroup.GET("/token/refresh", controller.RefreshToken)           // token刷新
		duApiGroup.GET("/file/list/normal", controller.DuGetFileListNormal) // 获取文件列表
		duApiGroup.GET("/file/detail", controller.DuGetFileDetail)          // 获取文件列表
		duApiGroup.GET("/file/download", controller.GetPlayUrlByDlink)      // 文件下载
		duApiGroup.GET("/file/streaming", controller.GetFileStreaming)      // 获取视频流

	}
	return r
}
